package com.ww.action;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ww.service.EssayService;
import com.ww.service.ExerciseService;
import com.ww.service.UserService;

public class MainAction extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String type = request.getParameter("type");
		if (1 == 2) {
		} else {
			// 活动信息
			List<Map> exerciseList = new ExerciseService().getCurrentExercise();
			// 指定文章
			List<Map> wzTopList = new EssayService().getWzTop();

			List<Map> jyTopList = new EssayService().getjyTop();

			List<Map> crditTopList = new UserService().getUserCrditTop();

			request.setAttribute("exerciseList", exerciseList);
			request.setAttribute("wzTopList", wzTopList);
			request.setAttribute("jyTopList", jyTopList);
			request.setAttribute("crditTopList", crditTopList);
			request.getRequestDispatcher("/index.jsp").forward(request, response);
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
